package com.example.test.主方法运行测试;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;

public class Main3 {
    public static void main(String[] args) {
//        String path = "C:\\Users\\Administrator\\Desktop\\20167.jpg";
//        InputStream inputStream = FileUtil.getInputStream(path);
//
//        File file1 = new File("temp/demo.jpeg");
//
//        FileUtil.writeFromStream(inputStream,file1);
//        file1.deleteOnExit();

        String[] attr1 = new String[]{"A", "B", "C", "D", "E", "F", null};
        String[] attr2 = new String[]{"1", "2", "3", "D", "E", "F", null};

        ArrayList<String> list1 = new ArrayList<>(Arrays.asList(attr1));
        ArrayList<String> list2 = new ArrayList<>(Arrays.asList(attr2));

        System.out.println("交集：" + CollectionUtil.intersection(list1, list2)); // 交集
        System.out.println("补集：" + CollectionUtil.disjunction(list1, list2)); // 补集
        System.out.println("并集：" + CollectionUtil.union(list1, list2)); //并集
        System.out.println("list1的差集" + CollectionUtil.subtract(list1, list2));
//        System.out.println("list2的差集" + CollectionUtil.subtract(list2, list1));
//        System.out.println("list1的差集：" + CollectionUtil.subtractToList(list1, list2));
//        System.out.println("list2的差集：" + CollectionUtil.subtractToList(list2, list1));

        try {
            int i = 9;
            if (i > 7) {
                throw new Exception("JKLJDAF");
            }

        } catch (Exception e) {
            System.out.println(e.getMessage());
        }


    }
}
